//
//  LJHBaseTableView.m
//  HEARME
//
//  Created by 曲政永 on 16/1/21.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LJHBaseTableView.h"

@implementation LJHBaseTableView
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style{
    self = [super initWithFrame:frame style:style];
    
    if (self) {
        
        if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"]) {
            self.backgroundColor = [UIColor lightGrayColor];
        }
        else
        {
            self.backgroundColor = [UIColor whiteColor];
        }
        
    }
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeColor:) name:@"changeColor" object:nil];
    
    UIView *view = [[UIView alloc] init];
    self.tableFooterView = view;
    return self;
}
    
-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"changeColor" object:nil];
    [super dealloc];
}

-(void)changeColor:(NSNotification *)notifition
{
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Mode"] isEqualToString:@"night"])
    {
        self.backgroundColor = [UIColor lightGrayColor];
        
    }
    else
    {
        self.backgroundColor = [UIColor whiteColor];
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
